/* Router */
import { createRouter, createWebHistory, type RouteRecordRaw } from 'vue-router'
import type { App } from 'vue'

// Router components
import { Default, MainInfoManagement } from "@/views";

// Router configuration
const routes: Array<RouteRecordRaw> = [
    {
        path: '/',
        name: '/',
        component: Default,
        meta: {
            breadcrumb: { name: "首页" }
        },
        children: [
            {
                path: "/main-info-management",
                name: "main-info-management",
                component: MainInfoManagement,
                meta: {
                    breadcrumb: { name: "主体信息管理" }
                }
            }
        ]
    },
]

// Router instance
const router = createRouter({
    history: createWebHistory(import.meta.env.BASE_URL),
    routes
})

// Export setup function
export const setupRouter = async (app: App) => {
    app.use(router)
    await router.isReady()
}
